<%@ page language="java" pageEncoding="UTF-8"
         contentType="text/html; charset=UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <%@ include file="/common/common.jsp" %>
    <meta name="format-detection"
          content="telephone=no,email=no,date=no,address=no">
    <title>收单详情成功</title>
    <link rel="stylesheet" type="text/css" href="${ctx }/statics/aui/css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="${ctx }/css/weui.min.css"/>
    <script src="${ctx }/statics/libs/jquery.min.js"></script>

    <style type="text/css">
        .refresh_test {
            font-family: PingFangSC-Regular;
            font-size: 14px;
            color: #666666;
            line-height: 21px;
            text-align: center;
        }

        .receivables_error {
            font-family: PingFangSC-Regular;
            font-size: 18px;
            color: #333333;
            text-align: center;
        }

        .receivables_text {
            font-family: PingFangSC-Regular;
            font-size: 15px;
            color: #666666;
            line-height: 30px;
            text-align: right;
        }

        .receivables_amt {
            font-family: PingFangSC-Regular;
            font-size: 20px;
            color: #333333;
            line-height: 21px;
            text-align: right;
        }

        .refresh_testQBTK {
            font-family: PingFangSC-Regular;
            font-size: 13px;
            color: #ed3f44;
            text-align: center;
        }
    </style>
</head>

<body>

<section class="aui-content-padded">
    <center>
        <div style="margin-top: 35px;">
            <img alt="错误图标"
                 src="<c:choose>
				<c:when test="${dateGroupingTk.payResult==0 }">${ctx }/statics/aui/images/success1.png</c:when>
					<c:otherwise>${ctx }/statics/aui/images/fail.png</c:otherwise>
				</c:choose>">
        </div>
    </center>
    <center>
        <p class="receivables_error" style="margin-top: 8px;">
            <!-- 记得修改 -->
            <c:choose>
                <c:when test="${dateGroupingTk.payResult==0 }">
                    <c:choose>
                        <c:when test="${dateGroupingTk.status==2 }">退款成功</c:when>
                        <c:when test="${dateGroupingTk.status==5 }">退款处理中</c:when>
                        <c:when test="${dateGroupingTk.status==6 }">未确定</c:when>
                        <c:when test="${dateGroupingTk.status==10 }">转入退款</c:when>
                        <c:when test="${dateGroupingTk.status==11 }">未支付</c:when>
                        <c:when test="${dateGroupingTk.status==12 }">已冲正</c:when>
                        <c:when test="${dateGroupingTk.status==13 }">已撤销</c:when>
                        <c:otherwise>收款异常</c:otherwise>
                    </c:choose>
                </c:when>
                <c:when test="${dateGroupingTk.payResult==1 }">退款失败</c:when>
                <c:otherwise>收款异常</c:otherwise>
            </c:choose>
        </p>
    </center>
    <center>
        <c:choose>
            <c:when test="${dateGroupingTk.refundtype==0 }"><p class="refresh_test">部分退款</p></c:when>
            <c:when test="${dateGroupingTk.refundtype==1 }"><p class="refresh_testQBTK">全部退款</p></c:when>
            <c:otherwise><p class="refresh_test">退款异常</p></c:otherwise>
        </c:choose>
    </center>
</section>
<section class="aui-content">
    <ul class="aui-list">

        <li class="aui-list-item" style="border-bottom-color: #FFFFFF">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title receivables_text">退款金额</div>
                <div class="aui-list-item-right receivables_amt">${dateGroupingTk.amount }</div>
            </div>
        </li>
        <li class="aui-list-item   " style="border-bottom-color: #FFFFFF">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title receivables_text">退款状态</div>
                <div class="aui-list-item-right  ">
                    <c:choose>
                        <c:when test="${dateGroupingTk.payResult==0 }">
                            <c:choose>
                                <c:when test="${dateGroupingTk.status==2 }">退款成功</c:when>
                                <c:when test="${dateGroupingTk.status==5 }">退款处理中</c:when>
                                <c:when test="${dateGroupingTk.status==6 }">未确定</c:when>
                                <c:when test="${dateGroupingTk.status==10 }">转入退款</c:when>
                                <c:when test="${dateGroupingTk.status==11 }">未支付</c:when>
                                <c:when test="${dateGroupingTk.status==12 }">已冲正</c:when>
                                <c:when test="${dateGroupingTk.status==13 }">已撤销</c:when>
                                <c:otherwise>收款异常</c:otherwise>
                            </c:choose>
                        </c:when>
                        <c:when test="${dateGroupingTk.payResult==1 }">退款失败</c:when>
                        <c:otherwise>收款异常</c:otherwise>
                    </c:choose>
                </div>
            </div>
        </li>
        <li class="aui-list-item   ">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title receivables_text">退款单号</div>
                <div class="aui-list-item-right  ">${dateGroupingTk.recordNo}</div>
            </div>
        </li>

        <c:if test="${dateGroupingTk.payResult==0 }">
            <li class="aui-list-item   ">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title receivables_text">退款流水号</div>
                    <div class="aui-list-item-right  ">${dateGroupingTk.refundId }</div>
                </div>
            </li>
        </c:if>


        <%--<li class="aui-list-item" style="border-bottom-color: #FFFFFF">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title receivables_text">实收金额</div>
                <div class="aui-list-item-right receivables_amt">+
                    ${dateGrouping.amount }</div>
            </div>
        </li>--%>
        <li class="aui-list-item">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title receivables_text">订单金额</div>
                <div class="aui-list-item-right receivables_amt">+
                    ${dateGrouping.amount }</div>
            </div>
        </li>
        <li class="aui-list-item" style="border-bottom-color: #FFFFFF">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title receivables_text">交易时间</div>
                <div class="aui-list-item-right ">
                    <fmt:formatDate value="${dateGrouping.orderdate }"
                                    pattern="yyyy-MM-dd HH:mm:ss"/>
                </div>
            </div>
        </li>
        <li class="aui-list-item" style="border-bottom-color: #FFFFFF">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title receivables_text">付款方式</div>
                <div class="aui-list-item-right" title="${dateGrouping.resource }">
                    <c:choose>
                        <c:when test="${dateGrouping.resource==0 }">微信</c:when>
                        <c:when test="${dateGrouping.resource==1 }">支付宝</c:when>
                        <c:otherwise>其它</c:otherwise>
                    </c:choose>
                </div>
            </div>
        </li>
        <li class="aui-list-item" style="border-bottom-color: #FFFFFF">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title receivables_text">付款方</div>
                <div class="aui-list-item-right">
                    <c:choose>
                        <c:when test="${dateGrouping.resource==0 }">微信用户:  ${dateGroupingTk.wxNickName }</c:when>
                        <c:when test="${dateGrouping.resource==1 }">支付宝用户:  ${dateGroupingTk.wxNickName }</c:when>
                        <c:otherwise>其它用户</c:otherwise>
                    </c:choose>
                </div>
            </div>
        </li>
        <li class="aui-list-item" style="border-bottom-color: #FFFFFF">
            <div class="aui-list-item-inner" onclick="location='${ctx}/trading/details?recordNo=${dateGrouping.recordNo}'">
                <div class="aui-list-item-title receivables_text">订单号</div>
                <div class="aui-list-item-right">${dateGrouping.recordNo }</div>
            </div>
        </li>

    </ul>
</section>

<section class="aui-content"
         style="margin-top: 44px; padding-left: 20px; padding-right: 20px;">
    <input type="hidden" id="id" name="id" value="${dateGroupingTk.id}">
    <p>
        <c:if test="${dateGroupingTk.payResult!=0 && dateGroupingTk.status==6}">
    <div class="aui-btn aui-btn-info  aui-btn-block"
         onclick="againRefund()">退款
    </div>
    </c:if>
    </p>
    <br>
    <br>
</section>

<div id="dialogs">
    <div class="js_dialog" id="iosDialog2" style="display: none;">
        <div class="weui-mask"></div>
        <div class="weui-dialog">
            <div class="weui-dialog__bd" id="DialogMessage"></div>
            <div class="weui-dialog__ft">
                <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary DeleteDefault">确定</a>
            </div>
        </div>
    </div>
</div>

</body>
<script type="text/javascript">

	var $iosDialog2 = $('#iosDialog2');
	$('#dialogs').on('click', '.DeleteDefault', function () { //取消按钮事件
	    $(this).parents('.js_dialog').fadeOut(200);
	});
	
    //重新发起支付
    function againRefund() {
        $.ajax({
            type: "POST",
            url: "${ctx}/payorder/againRefund?id=" + $("#id").val(),
            dataType: 'json',
            success: function (result) {
                if (result.code == 0) {
                    window.location.href = "${ctx}/trading/details?recordNo=${dateGroupingTk.recordNo}";
                } else {
                	$("#DialogMessage").html(result.msg);
                    $iosDialog2.fadeIn(200);
                }
            }
        });
    }
</script>
</html>
